﻿<%@ page contentType="text/html; charset=UTF-8" language="java" import="java.util.*,org.yoao.crm.tools.PubFunction,org.yoao.crm.dao.RoleDAO"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
	String roleName = request.getParameter("roleName");
%>
<html>
<head>
<!-- 08.04 -->
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>请选择数据</title>
<jsp:include page="../public/publicJs.jsp" flush="false"></jsp:include>
<script language="javascript">
function getSelectValue(){
	var objSelect = document.getElementById("datalist");
	var value = "";   
	for(i=0;i<objSelect.length;i++){      
		if(objSelect.options[i].selected){   
			value += objSelect.options[i].value + ";"; 
		}
	}
	if(value.lastIndexOf(";") == value.length-1) value = value.substring(0, value.length-1);
	window.returnValue = value;
	window.close();
}
function cancelRole(){
	window.returnValue = "CANCELROLE";
	window.close();
}
function searchSubmit(){
	document.all.searchbar.submit();
}
</script>
</head>
<base target="_self"/>
<body>
<div id="cwMain">
<table width="100%" height="20" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td  valign="top">
<form id="searchbar" name="searchbar" action="datawindow.jsp" method="post">
<table  id="title_top" border="0" cellspacing="0" cellpadding="0" width="100%" >
	<tr  class="tree_title_txt">
        <td nowrap align="right"  class="tree_title_txt">
                                角色名称: <input type="text" name="roleName" value="<%=roleName!=null?roleName:""%>" style="width:90px">
            <image src="<%=basePath%>images/tbtn_searh.gif" alt="查询" align="absmiddle" style="cursor:hand" onClick="searchSubmit()"/></td>
    </tr>
</table>
</form>
<%
String sql = "select roleId, roleName from userRole ";
if(roleName != null && !roleName.trim().equals("")) sql += " where roleName like'%"+roleName+"%'";
List list = new RoleDAO().queryMultiColumn(sql);
%>
<select name="datalist" size="15" multiple style="width:100%" ondblclick="getSelectValue()">
<option selected></option>
<%
if(list != null){
	int size = list.size();
	for(int i=0;i<size;i++){
		Map map = (Map)list.get(i);
		String accessSno = (String)map.get("ROLEID");
		String accessName = (String)map.get("ROLENAME");
		accessSno = accessSno + "|" + accessName;
%>
		<option value="<%=accessSno%>"><%=accessName%></option>
<%
	}
}
%>
</select>
</td>
</tr>
<tr>
   <td align="center" height="30">
   	<input class="com_button" type="button" value="确定" onClick="getSelectValue();">
   	<input class="com_button" type="button" value="取消" onClick="cancelRole();">
   </td>
</tr>
</table>
</div>
</body>
</html>